package java_demos.java_basic.collection_examples;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class CollectionExamples {
    public static void main(String[] args) {
        /*
        * ArraryList的使用
        * */

        List<String> arraryList  = new ArrayList<>();
        arraryList.add("Apple");
        arraryList.add("Banana");
        arraryList.add("Orange");
        System.out.println("ArraryList:"+arraryList);

        /*
        * LinkedList的使用
        * */
        List<String> linkedList = new LinkedList<>();
        linkedList.add("Dog");
        linkedList.add("Cat");
        System.out.println("LinkedList:"+linkedList);

        /*
        * HashSet的使用
        * */

        Set<String> hashSet = new HashSet<>();
        hashSet.add("Alpha");
        hashSet.add("Beta");
        hashSet.add("Gamma");
        System.out.println("HashSet:"+hashSet);

        /*
        * HashMap的使用
        * */

        Map<String,Integer> hashMap = new HashMap<>();
        hashMap.put("One", 1);
        hashMap.put("Two", 2);
        hashMap.put("Three", 3);
        hashMap.put("Four", 4);
        System.out.println("HashMap:"+hashMap);


        /*
        * TreeMap的使用
        * */
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("One", 1);
        treeMap.put("Two", 2);
        treeMap.put("Three", 3);
        treeMap.put("Four", 4);
        System.out.println("TreeMap:"+treeMap);

        /*
        *   ConcurrentHashMap的使用
        * */

        Map<String,Integer> concurrentTreeMap = new ConcurrentHashMap<>();
        concurrentTreeMap.put("One", 1);
        concurrentTreeMap.put("Two", 2);
        concurrentTreeMap.put("Three", 3);
        concurrentTreeMap.put("Four", 4);
        System.out.println("ConcurrentTreeMap:"+concurrentTreeMap);


        /*
        * PriorityQueue的使用
        * */
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        priorityQueue.add(1);
        priorityQueue.add(2);
        priorityQueue.add(3);
        priorityQueue.add(4);
        System.out.println("PriorityQueue:"+priorityQueue);


    }
}
